import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-03-30
 * Time: 17:06
 */
public class test10 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int T = scan.nextInt();
        for (int i = 0; i < T; i++) {
            int n = scan.nextInt();
            int k = scan.nextInt();
            int[] a = new int[2 * n];
            for (int j = 0; j < n * 2; j++) {
                a[j] = scan.nextInt();
            }
            myShuffle(a,n,k);
        }
    }

    private static void myShuffle(int[] a, int n, int k) {

        for (int i = 0; i < k; i++) {
            int[] card = new int[n * 2];
            for (int j = 0; j < n; j++) {

                card[2 * j] = a [j];
//                int tmp = a[j + n];
                card[2 * j + 1] = a[j+n];
            }
            a = card;
        }
        for (int i = 0; i < n * 2 - 1; i++) {

            System.out.print(a[i] + " ");
        }
        System.out.println(a[n * 2 - 1]);
    }
}
